﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
using Red.Controls.Extensions;

namespace Red.Controls.Converters
{
    public sealed class LightenColorConverter : IValueConverter
    {
        public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
        {
            var color = ( Color )value;
            var lightFactor = 1.0f;
            float.TryParse( ( string )parameter, out lightFactor );
            return color.Lighten( lightFactor );
        }

        public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
        {
            throw new NotImplementedException();
        }
    }
}
